Fully Qualified Name: | Laminas\I18n\Translator\Translator |
Implements: | TranslatorInterface |
Translator.
Name | Description | Defined By |
---|---|---|
addRemoteTranslations() | Add remote translations. | Translator |
addTranslationFile() | Add a translation file. | Translator |
addTranslationFilePattern() | Add multiple translations with a file pattern. | Translator |
clearCache() | Clears the cache for a specific textDomain and locale. | Translator |
disableEventManager() | Disable the event manager. | Translator |
enableEventManager() | Enable the event manager. | Translator |
factory() | Instantiate a translator | Translator |
getAllMessages() | Return all the messages. | Translator |
getCache() | Returns the set cache | Translator |
getCacheId() | Get the cache identifier for a specific textDomain and locale. | Translator |
getEventManager() | Get the event manager. | Translator |
getFallbackLocale() | Get the fallback locale. | Translator |
getLocale() | Get the default locale. | Translator |
getPluginManager() | Retrieve the plugin manager for translation loaders. | Translator |
isEventManagerEnabled() | Check whether the event manager is enabled. | Translator |
setCache() | Sets a cache | Translator |
setEventManager() | Set the event manager instance used by this translator. | Translator |
setFallbackLocale() | Set the fallback locale. | Translator |
setLocale() | Set the default locale. | Translator |
setPluginManager() | Set the plugin manager for translation loaders | Translator |
translate() | Translate a message. | Translator |
translatePlural() | Translate a plural message. | Translator |
Add remote translations.
Parameter Name | Type | Description |
---|---|---|
$type | string | |
$textDomain | string |
Returns: $this
Add a translation file.
Parameter Name | Type | Description |
---|---|---|
$type | string | |
$filename | string | |
$textDomain | string | |
$locale | string|null |
Returns: $this
Add multiple translations with a file pattern.
Parameter Name | Type | Description |
---|---|---|
$type | string | |
$baseDir | string | |
$pattern | string | |
$textDomain | string |
Returns: $this
Clears the cache for a specific textDomain and locale.
Parameter Name | Type | Description |
---|---|---|
$textDomain | string | |
$locale | string |
Returns: bool
Disable the event manager.
Returns: $this
Enable the event manager.
Returns: $this
Instantiate a translator
Parameter Name | Type | Description |
---|---|---|
$options | array|\Traversable |
Returns: static
Return all the messages.
Parameter Name | Type | Description |
---|---|---|
$textDomain | string | |
$locale | string|null |
Returns: mixed
Returns the set cache
Returns: \CacheStorage|null The set cache
Get the cache identifier for a specific textDomain and locale.
Parameter Name | Type | Description |
---|---|---|
$textDomain | string | |
$locale | string |
Returns: string
Get the event manager.
Returns: \EventManagerInterface
Get the fallback locale.
Returns: string|null
Get the default locale.
Returns: string
Retrieve the plugin manager for translation loaders.
Lazy loads an instance if none currently set.
Returns: \LoaderPluginManager
Check whether the event manager is enabled.
Returns: bool
Sets a cache
Parameter Name | Type | Description |
---|---|---|
$cache | \CacheStorage|null |
Returns: $this
Set the event manager instance used by this translator.
Parameter Name | Type | Description |
---|---|---|
$events | \EventManagerInterface |
Returns: $this
Set the fallback locale.
Parameter Name | Type | Description |
---|---|---|
$locale | string|null |
Returns: $this
Set the default locale.
Parameter Name | Type | Description |
---|---|---|
$locale | string|null |
Returns: $this
Set the plugin manager for translation loaders
Parameter Name | Type | Description |
---|---|---|
$pluginManager | \LoaderPluginManager |
Returns: $this
Translate a message.
Parameter Name | Type | Description |
---|---|---|
$message | string | |
$textDomain | string | |
$locale | string|null |
Returns: string
Translate a plural message.
Parameter Name | Type | Description |
---|---|---|
$singular | string | |
$plural | string | |
$number | int | |
$textDomain | string | |
$locale | string|null |
Returns: string